<?php
namespace app\task\controller;
use app\task\logic\DealWorkCircleLogic;

/**
 * 处理工作圈
 * Created by PhpStorm.
 * User: tyll
 * Date: 2019/10/30
 * Time: 14:22
 */
class DealWorkCircle extends Base {

    public function __construct(){
        parent::__construct();
        $this->dwc_logic = new DealWorkCircleLogic();
    }

    /**
     * 处理工作圈消息置顶超时
     * @return \think\response\Json
     */
    public function deal_wc_is_top(){
        $now_date = date('Y-m-d');

        $wrm_data = [];

        $maps = [];
        $maps[] = ['is_top','=',1];
        $maps[] = ['top_out_time','<',$now_date];
        $wrmids = model('work_circle_msg')->get_column($maps,'id');
        foreach($wrmids as $k => $v){
            $wrm_data[$k]['id'] = $v;
            $wrm_data[$k]['is_top'] = 0;
        }
        $r = model('work_circle_msg')->saveAll($wrm_data);
        return json($this->dwc_logic->get_response(1,'处理工作圈消息置顶超时，日期：' . $now_date));
    }
}
